package lyf;

import lyf.framework.beans.BeanFactory;
import lyf.framework.core.ClassScanner;
import lyf.framework.web.handler.HandlerManager;
import lyf.framework.web.tomcat.TomcatServer;

import java.util.List;

/**
 * 启动类
 */
public class MiniApplication {
	/**
	 * 程序入口
	 */
	public static void main(String[] args) {
		try {
			// 启动tomcat服务
			new TomcatServer(args).startServer();
			// 加载所有class类
			List<Class<?>> classList = ClassScanner.scanClasses(MiniApplication.class.getPackage().getName());
			// bean工厂加载bean
			BeanFactory.initBean(classList);
			// 初始化处理器映射器
			HandlerManager.resolveMappingHandler(classList);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
